<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="jQuery.min.js"></script>
    <style>
        div {
            width: 200px;
            height: 200px;
            background-color: skyblue;
            margin: 100px auto;
        }

        .current {
            background-color: red;
        }
    </style>
</head>

<body>
    <div></div>
    <script>
        $(function () {
            $("div").click(function () {
                // $(this).addClass("current");//添加
                // $(this).removeClass("current");//移除
                $(this).toggleClass("current");//切换
            })
        })
    </script>
</body>

</html>